package socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Random;

public class ClienteFiboTeste {

    public static void main(String[] args) throws Exception {
        Socket s2 = new Socket("localhost", 8085);
        BufferedReader entrada = new BufferedReader(new InputStreamReader(s2.getInputStream()));
        PrintWriter saida = new PrintWriter(new OutputStreamWriter(s2.getOutputStream()));
         Random r = new Random();
         for(int i =1;i<10000;i++){
             saida.println(r.nextInt(20));
             saida.flush();
             Long l1 = new Long (entrada.readLine());
             System.out.println("Recebido: " + l1);
         }
         saida.println(-1);
         saida.flush();
          s2.close();
    }
}
